-- msg_upload_dungeon_log
-- Create by wudm
-- 上传地牢日志

return function(lpc)
    trace("msg_upload_dungeon_log", "上传地牢日志");

    if Socket.isConnected() then
        --enableGC();

        local data = DungeonLogM.getUserData(lpc.layer);
        if not data then
            return;
        end
        DungeonLogM.clearUserData(lpc.layer);
        --[[data = LPC.saveString(data);

        local zlib = require "zlib";
        local buf = zlib.compress(data);
        local b = Buffer.create(4);
        Buffer.setu32(b, 1,  string.len(data));
        Buffer.append(b, buf);
        print(string.format("上传地牢日志，大小(%d -> %d)", string.len(data), string.len(buf)));
                           ]]

        -- 直接发送到gs
        local now = socket.gettime();
        Communicate.send("CMD_COLLECT_DUNGEON_LOG", { ["log_data"] = data, ["dungeon_id"] = lpc.dungeon_id, ["layer"] = lpc.layer, });
        cclog("send_cmd_client_log  cost : %d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!", socket.gettime() - now);
        --disableGC();
    end
end
